App Deletion

Apps can be deleted with or without a cascade option. A cascade delete, deletes both the app and its resources, rather than only the app.

Deletion Using argocd

To perform a non-cascade delete:

  1. argocd app delete APPNAME --cascade=false

To perform a cascade delete:

  1. argocd app delete APPNAME --cascade

or

  1. argocd app delete APPNAME

Deletion Using kubectl

To perform a non-cascade delete, make sure the finalizer is unset and then delete the app:

  1. kubectl patch app APPNAME -p '{"metadata": {"finalizers": null}}' --type merge
  2. kubectl delete app APPNAME

To perform a cascade delete set the finalizer, e.g. using kubectl patch:

  1. kubectl patch app APPNAME -p '{"metadata": {"finalizers": ["resources-finalizer.argocd.argoproj.io"]}}' --type merge
  2. kubectl delete app APPNAME

About The Deletion Finalizer

For the technical amongst you, the Argo CD application controller watches for this finalizer:

  1. metadata:
  2. finalizers:
  3. # The default behaviour is foreground cascading deletion
  4. - resources-finalizer.argocd.argoproj.io
  5. # Alternatively, you can use background cascading deletion
  6. # - resources-finalizer.argocd.argoproj.io/background

Argo CD’s app controller watches for this and will then delete both the app and its resources.

The default propagation policy for cascading deletion is foreground cascading deletion. ArgoCD performs background cascading deletion when resources-finalizer.argocd.argoproj.io/background is set.

When you invoke argocd app delete with --cascade, the finalizer is added automatically. You can set the propagation policy with --propagation-policy <foreground|background>.